package UI;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * When you click on this MenuItem, it reads a file name from <code>fileNameTextField</code> and writes the number of its last version to <code>versionTextField</code>.
 * @author Anna
 */
public class GetLastVersionMenuItem extends SpecialMenuItem {
    public GetLastVersionMenuItem(){
        super("Get file last version");
        addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                String s = fileNameTextField.getText();
                int version = 0;
                version = connect.getLastVersion(s);
                versionTextField.setText(String.valueOf(version));
            }
        });
    }
}
